home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 6332 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: rcp6.elan.af.mil!rscernix!danpop
  2. From: danpop@mail.cern.ch (Dan Pop)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: sscanf bug??????
  5. Date: 23 Feb 96 12:57:33 GMT
  6. Organization: CERN European Lab for Particle Physics
  7. Message-ID: <danpop.825080253@rscernix>
  8. References: <4fimvo$82s@fnord.dfw.net> <4fqfeo$7mh@umbc9.umbc.edu> <4gh7dc$i2@mailhub.scitec.com.au> <825032700snz@genesis.demon.co.uk>
  9. NNTP-Posting-Host: ues5.cern.ch
  10. X-Newsreader: NN version 6.5.0 #7 (NOV)
  11.  
  12. In <825032700snz@genesis.demon.co.uk> Lawrence Kirby <fred@genesis.demon.co.uk> writes:
  13.  
  14. >However for complete accuracy:
  15. >
  16. >int main(void)
  17. >
  18. >and
  19. >
  20. >main(void)
  21. >
  22. >both specify a function that takes no arguments and returns int. Exactly
  23. >the same amount of compiler checking is required by the C language in
  24. >both cases.
  25.  
  26. This is true, but in the first case the compiler will detect errors which
  27. needn't be detected in the second case, i.e. the famous bad structure
  28. declaration:
  29.  
  30.     struct foo {
  31.     int bar;
  32.     }
  33.  
  34.     main(void)
  35.  
  36. Although declaring main as returning void is by far the most common
  37. mistake, declaring it as returning a struct might happen, as well :-)
  38.  
  39. Dan
  40. --
  41. Dan Pop
  42. CERN, CN Division
  43. Email: danpop@mail.cern.ch 
  44. Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland
  45.